#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
using ull = unsigned long long;
const int N = 1e6 + 5;

int n;
char s[N];
ull f[N], p[N];
bool check(int len) {
  for (int l = 1, r = 0; l <= n; l = r + 1) {
    r = min(r + len, n);
    ull x = f[r] - f[l - 1] * p[r + 1 - l];
    if (x != f[r + 1 - l]) return false;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 1, n) cin >> s[i];
  p[0] = 1;
  rep(i, 1, n) p[i] = p[i - 1] * 131;
  rep(i, 1, n) f[i] = f[i - 1] * 131 + s[i] - 'a';
  int ans = n;
  rep(i, 1, n - 1) {
    if (check(i)) {
      ans = i;
      break;
    }
  }
  cout << ans;
  return 0;
}